// 定义一个简易的表头
const simpleTable = {
  columns: [
    { width: 100, height: 40, label: '姓名', prop: 'name' },
    { width: 100, height: 40, label: '年龄', prop: 'age' },
    { width: 100, height: 40, label: '性别', prop: 'gender' }
  ],
  data: [
    { name: '张三', age: 20, gender: '男' },
    { name: '李四', age: 25, gender: '女' },
    { name: '王五', age: 30, gender: '男' }
  ],
  tableConfig: {
    header: {
      fontSize: 14,
      fontColor: '#333',
      fontFamily: 'Arial',
      fontWeight: 'bold',
      cell: {
        mixWidth: 100,
        minHeight: 40,
        fillColor: '#f0f0f0',
        borderWidth: 1,
        borderColor: '#ccc'
      }
    },
    body: {
      fontSize: 12,
      fontColor: '#666',
      fontFamily: 'Arial',
      fontWeight: 'normal',
      cell: { fillColor: '#fff', borderWidth: 1, borderColor: '#ccc' }
    }
  }
}

// 多级表头
const complexTable = {
  columns: [
    {
      width: 100,
      height: 30,
      label: '姓名',
      prop: 'name'
    },
    {
      width: 100,
      height: 30,
      label: '年龄',
      prop: 'age'
    },
    {
      height: 30,
      label: '成绩',
      prop: 'score',
      children: [
        {
          width: 70,
          height: 30,
          label: '语文',
          prop: 'chinese'
        },
        {
          width: 80,
          height: 30,
          label: '数学',
          prop: 'math'
        }
      ]
    }
  ],
  data: [
    { name: '张三', age: 20, chinese: 80, math: 90 },
    { name: '李四', age: 22, chinese: 75, math: 85 }
  ],
  tableConfig: {
    header: {
      fontSize: 14,
      fontColor: '#333',
      fontFamily: 'Arial',
      fontWeight: 'bold',
      cell: {
        mixWidth: 100,
        minHeight: 30,
        fillColor: '#f0f0f0',
        borderWidth: 1,
        borderColor: '#ccc'
      }
    },
    body: {
      fontSize: 12,
      fontColor: '#666',
      fontFamily: 'Arial',
      fontWeight: 'normal',
      cell: { fillColor: '#fff', borderWidth: 1, borderColor: '#ccc' }
    }
  }
}
import CanvasTable from '../../dist/index.js'

const canvasTable = new CanvasTable()
canvasTable
  .useParse()
  .parseTable(simpleTable)
  .then(() => {
    canvasTable.drawTable().then((canvas) => {
      console.log(canvas)
    })
  })

export { simpleTable, complexTable }
